package com.mall.implementation;

import java.util.ArrayList;

import com.mall.core.Item;

public class ShopingCartImpl implements com.mall.core.ShopingCart {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
private ArrayList<Item> addeditems = new ArrayList<Item>();
private int id;
	@Override
	public Item getItem(int id) {
		Item returnitem = null;
		for(Item item : this.addeditems){
			if(item.getId()==id){
			returnitem = item;	
			}
		}
		return returnitem;
	}


	@Override
	public ArrayList<Item> getItems() {

		return addeditems;
	}

	@Override
	public int getShoppingCartItemCount() {
		
		return addeditems.size();
	}


	@Override
	public int getId() {
		return id;
	}

	@Override
	public void setId(int id) {
	this.id=id;
		
	}

	@Override
	public void setItem(Item item) {
	this.addeditems.add(item);
		
	}

	@Override
	public void setItems(ArrayList<Item> item) {
		for(Item itemm : item){
			this.addeditems.add(itemm);
			
		}
		
	}


	}
